<?php
	header ('Access-Control-Allow-Origin: *');
	header ('Access-Control-Allow-Methods: POST');
	
	include_once ('function/function.php');
	include_once ('function/conn.php');

	function removeBook($uid, $bid, $include_history = true) {
		if (!$include_history) {$include_history = true;}

		$result_history = false;
		$returnObject = array();

		if (!$uid || empty($uid)) {
			$returnObject = (object) array(
				"error_code" => 2000,
				"error_msg" => "参数错误：uid不能为空",
			);

			return $returnObject;
		}

		if (!$bid || empty($bid)) {
			$returnObject = (object) array(
				"error_code" => 2001,
				"error_msg" => "参数错误：bid不能为空",
			);

			return $returnObject;
		}

		$result = mysql_query("delete from `book-lite_list` where bid='$bid' and uid='$uid'");

		if ($include_history == "true") {
			$result_history = mysql_query("delete from `book-lite_history` where bid='$bid' and uid='$uid'");
		}

		$returnObject = array(
			"result" => $result,
			"result_history" => $result_history
		);

		return $returnObject;
	}
?>